<template>
  <div class="info" v-loading="loading">
    <div class="card_con search_data mb15">
      <el-row class="mb15">
        <el-col :span="8" class="pr40">
          <div class="fz13 mb10">关键搜索：</div>
          <el-input
            clearable
            v-model="keyName"
            placeholder="请输入手机号"
          ></el-input>
        </el-col>
        <el-col :span="8" class="pr40">
          <div class="fz13 mb10">时间</div>
          <el-date-picker
            value-format="yyyy-MM-dd HH:mm:ss"
            v-model="time"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </el-date-picker>
        </el-col>
        <el-col :span="4">
          <div class="fz13 mb10">&nbsp;</div>
          <el-button type="primary" @click="handleSearch">查询</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="card_con">
      <el-table
        border
        :data="tableData"
        :header-cell-style="{
          'text-align': 'center',
        }"
        :cell-style="{ 'text-align': 'center' }"
        style="width: 100%"
        highlight-current-row
      >
        <el-table-column prop="oid" label="提现编号" min-width="25%">
        </el-table-column>
        <el-table-column prop="bank_real" label="用户姓名" min-width="15%">
        </el-table-column>
        <el-table-column label="银行卡卡名 / 银行卡卡号" min-width="25%">
          <template slot-scope="scope">
            <div class="fz12">{{ scope.row.bank_name }}</div>
            <div>{{ scope.row.bank_card }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="money" label="提现金额" min-width="10%">
        </el-table-column>
        <el-table-column prop="time1" label="申请时间" min-width="20%">
        </el-table-column>
        <el-table-column prop="status" label="申请状态" min-width="10%">
          <template slot-scope="scope">
            <div v-if="scope.row.status === '已退回'" class="red">已退回</div>
            <div v-if="scope.row.status === '已完成'" class="green">已完成</div>
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="15%">
          <template slot-scope="scope">
            <div class="caozuo">
              <div
                class="handleExamine hand_cs"
                @click="handleDetail(scope.row)"
              >
                查看详情
              </div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <Pagination :page="page" @onCurrentChange="handleCurrentChange" />
      </div>
      <!-- 详情 -->
      <el-dialog
        class="editDialog"
        title="详情"
        :visible.sync="detailDialog"
        width="45%"
      >
        <DetailDialog v-if="detailDialog" :rowData="rowData"></DetailDialog>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import DetailDialog from "./examine_detail.vue";
import { cashList } from "@/api/money";
import Pagination from "@/components/Pagination.vue";
export default {
  components: { Pagination, DetailDialog },
  data() {
    return {
      loading: true,
      keyName: "",
      time: "",
      tableData: [],
      page: {
        total: 0,
        pageNum: 1, // 当前页数
        pageSize: 10, // 每页的条数
      },
      detailDialog: false,
      rowData: {},
    };
  },
  methods: {
    async cashList() {
      const { data, err } = await cashList({
        page: this.page.pageNum,
        key: this.keyName,
        st: this.time ? this.time[0] : 0,
        se: this.time ? this.time[1] : 0,
        type: 2,
      });
      if (err === 0) {
        this.loading = false;
        this.tableData = data.data;
        this.page.pageSize = data.per_page;
        this.page.total = data.total;
      }
    },
    //查询
    handleSearch() {
      this.loading = true;
      this.page.pageNum = 1;
      this.cashList();
    },
    //详情
    handleDetail(row) {
      this.rowData = row;
      this.detailDialog = true;
    },
    // 当前页: ${val}
    handleCurrentChange(val) {
      this.loading = true;
      this.page.pageNum = val;
      this.cashList();
    },
  },
  created() {
    this.cashList();
  },
};
</script>

<style lang="scss" scoped>
@import "@/style/index.scss";

.info {
  .title {
    font-size: 16px;
    margin-bottom: 13px;
  }
}
.pagination {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
}
.el-select {
  width: 100%;
}

.tb {
  background-color: #fff;
  padding: 20px;
  box-sizing: border-box;
}
.row {
  display: flex;
  border-radius: 2px;
  //   border: 1px solid #ccc;
  .l {
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    font-size: 13px;
    i {
      margin-right: 6px;
      font-size: 13px;
    }
    &:hover {
      cursor: pointer;
    }
  }
  .l:nth-child(1) {
    border-right: 0;
  }
}
.judg {
  text-align: center;
}
.editDialog {
  //   z-index: 2005 !important;
  /deep/.el-dialog {
    height: 75%;
    .el-dialog__body {
      height: 80%;
      overflow: auto;
    }
  }
}
.handleEdit {
  margin-left: 20px;
}
.handleDelete {
  margin-left: 20px;
}

/deep/.el-table .el-table__cell {
  padding: 10px 0;
}
.search_data {
  /deep/.el-input__inner {
    height: 36px;
    line-height: 36px;
    font-size: 13px;
  }
}

.beizhu {
  padding: 0 20px 50px 20px;
  box-sizing: border-box;
  .bz {
    margin-bottom: 10px;
    margin-top: 20px;
  }
  .btn {
    margin-top: 20px;
    .el-button {
      width: 100%;
    }
  }
}
</style>
